package org.example.yunshu.demos.controller;

import org.example.yunshu.demos.service.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/friend")
public class FriendController {

    @Autowired
    private FriendService friendService ;

    @RequestMapping("/getFriendListByUserId")
    public Object getFriendListByUserId(HttpSession httpSession){
        return friendService.getFriendListByUserId(httpSession);
    }

    // 删除好友
    @RequestMapping("/deleteFriend")
    public Object deleteFriend(Integer userId , Integer sessionId , String friendName ){
        return  friendService.deleteFriend(userId ,   sessionId , friendName) ;
    }
    // 搜索好友
    @RequestMapping("/searchFriends")
    public Object  searchFriends(String keyword , Integer userId){
        return friendService.searchFriends(keyword , userId);
    }

    @RequestMapping("/getAddList")
    public Object getAddList(Integer userId){
        return friendService.getAddList(userId) ;
    }

}
